<%@ page language="java" contentType="text/html; charset=utf-8"	pageEncoding="utf-8"%>

<html>
<head>
<script type="text/javascript" >



</script>

<script type="text/javascript">
var personStatusJson;  
$(document).ready(function () {         
	
})


/**
 * 保存页面数据
 */
 function saveperson() {
	//判断姓名是否为空
	var nameVal=$("#name").val();
	var pat=new RegExp("[^a-zA-Z0-9\_\u4e00-\u9fa5]","i"); 
	if(nameVal==null||nameVal==""){
		var spans= document.getElementById("massage")
		spans.style="display:inline-block;color:red"
		return;
	}
	if(pat.test(nameVal)==true) 
	  { 
		var spans= document.getElementById("massage2")
		spans.style="display:inline-block;color:red"
		return;
	  }
    //获取canvas的编码
    
    
    //将数据保存到数据库中
    $.ajax({
    	 url: "rest/person/save.do",
    	 type:'post',
    	 data:$("#person-fm").serialize(),  	 
    	 success:function (data){
    		 
      		 //返回到默认选中展示目录
      		 parent.showCenter('person/index.do');
      		 
      		//'http://'+host+'/personApi/addPhoto'
      	}

    	 });
} 
/**
 * 返回页面
 */
function back(url){
	$.get(url, {}, function(data){
		$("#center").empty();
        $("#center").html(data);
        $.parser.parse($("#center"));
    });
}
	
   /*  $('#person-fm').form('submit', {
        url: 'rest/person/save.do',        
        
        success: function (result) {
        	$.messager.progress('close'); 
            var result = eval('(' + result + ')');
            if (result.retCode=='0000') {
            	back('person/index.do');
                
            } else {
                $.messager.show({
                    title: 'Error',
                    msg: result.retMsg
                });
            }
        }
    }); */

</script>
</head>
<body>
		
<div class="linkbar"><a> 人员管理</a>/<a> 人员录入</a></div>
		<div id="person-add" 	buttons="#person-add-buttons">
			<form id="person-fm" method="post" novalidate enctype="multipart/form-data">
			<div class="fitem">
				<label>姓名:</label> <input name="name" id="name"
					class="easyui-validatebox" missingMessage="该输入项不能为空！"
					required="true" />
			    <span style="display:none" id="massage">请输入姓名!!!</span>
			    <span style="display:none" id="massage2">名字中不可包含非法字符!!!</span>
			</div>
			<div class="fitem">
				<label>部门:</label> <input name="deptment" id="deptment"
					class="easyui-validatebox" missingMessage="该输入项不能为空！"
					required="true" />
			    <span style="display:none" id="massage">请输入部门!!!</span>
			</div>
			<div class="fitem">
				<label>员工编号:</label> <input name="employeeNo" id="employeeNo"
					class="easyui-validatebox" missingMessage="该输入项不能为空！"
					required="true" />
			    <span style="display:none" id="massage">请输入员工编号!!!</span>
			</div>

			<!-- <div class="fitem">
				<label>照片:</label>  <input type="file" name="annexUrl" id="annexUrl" multiple="multiple"/>
			</div> -->
		</form>
		</div>
		<div id="dlg-buttons">
			<a href="#" class="easyui-linkbutton" iconCls="icon-ok" 	onclick="saveperson()">保存</a> 
			<a href="#" class="easyui-linkbutton" iconCls="icon-cancel" onclick="back('person/index.do')">返回</a>
		</div>
		

</body>
</html>
</html>